﻿using Microsoft.EntityFrameworkCore;
using NewRetail.Application.Components.WechatOrAlipayPayment.Entity;
using NewRetail.Application.Core.Entity;

namespace NewRetail.Application.Components.WechatOrAlipayPayment
{
    public static class WechatOrAlipayPaymentExtension
    {
        public static void ConfigureWechatOrAlipayPaymentEntities(this ModelBuilder modelBuilder)
        {

            //微信/支付宝支付结果记录
            var posPayResultFlowBuilder = modelBuilder.Entity<PosPayResultFlow>()
                .ConfigBaseEntity();

            posPayResultFlowBuilder.ToTable("pos_pay_result_flow");
            posPayResultFlowBuilder.Property(x => x.flowNo).IsRequired().HasMaxLength(50);
            posPayResultFlowBuilder.Property(x => x.tradeNo).IsRequired().HasMaxLength(50);
            posPayResultFlowBuilder.Property(x => x.payAmount).IsRequired().HasPrecision(18, 4);
            posPayResultFlowBuilder.Property(x => x.payWay).IsRequired().HasMaxLength(50);
            posPayResultFlowBuilder.Property(x => x.tradeStatus).IsRequired().HasMaxLength(100);
            posPayResultFlowBuilder.Property(x => x.payTime).HasColumnType("datetime");

        }
    }
}
